package targetToOffer.nintehDay;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Godc
 * @description
 */
public class FindContinuousSequence {
}
class FindContinuousSequenceSolution {
    /**
     * 滑动窗口
     * @param target
     * @return
     */
    public int[][] findContinuousSequence(int target) {
        List<int[]> list = new ArrayList<>();
        int i = 1,j=2,sum=3;
        while(i<j){
            if(sum==target){
                int[] temp = new int[j-i+1];
                for(int k = i;k<=j;k++){
                    temp[k-i] = k;
                }
                list.add(temp);
            }
            if(sum>=target){
                sum-=i;
                i++;
            }
            if(sum<target){
                j++;
                sum+=j;
            }
        }
        return list.toArray(new int[0][]);
    }

}